<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>终端SN号查询</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<s:url value="/css/a.css"/>" type="text/css"
	rel="stylesheet" />
<link href="<s:url value="/css/index.css"/>" type="text/css"

	rel="stylesheet" />
<link href="<s:url value="/css/common.css"/>" type="text/css" rel="stylesheet" />
	
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<style>
　　　
　　　　　a {
	text-decoration: none
}

　　　　　a:hover {
	color: red;
	text-decoration: none
}

a:VISITED {
	color: red;
}
　　　
</style>

<script type="text/javascript">
$(document).ready(function() {
	loadBrandCode();
	})
function deal(){

   var dd = $("input[name=terList]:checked");
	if(dd.length < 1){
		alert("请至少选择一个终端SN号");
		return false;
	}

 	$("#queryForm").attr("action","<%=basePath%>/serialNumQuery/SerialNumTer.ct");
	$("#queryForm").submit();
	$("#fenpei").attr("disabled", true);
	

}

//加载终端名称
function loadBrandCode() {
		var sortCode = $("#posBrand").val();
		if (sortCode==null||sortCode==""||sortCode=="-1") {
			$("#posName").empty().append("<option value='-1'>不限</option>");
			return;
		}
		MccQuery.loadBrandNameByCode(sortCode, function(sortSmall) {
			fillSelect_sort("posName", sortSmall,sortCode);
		});		
	}
function fillSelect_sort(sid, address,sortCode) {
	if (!address || !sid) {
		return;
	}
	
	var $select = $("#" + sid);
	$select.empty();
	
	$("#" + sid).empty().append("<option value='-1'>不限</option>");
    var selModelCode = $("#selModelCode").val();
    var oldBandCode = $("#oldBandCode").val();
	
	for ( var i = 0; i < address.length; i++) {
        var selStr = "";
		if(selModelCode != null && selModelCode != '' && address[i].CODE == selModelCode 
				&& sortCode == oldBandCode){
			selStr = " selected='selected' ";
		}
		$select.append("<option " + selStr + " value='"+address[i].CODE+"'>"
				+ address[i].NAME + "</option>");
	}
}		
</script>

</head>

<body>
<s:form id="queryForm" action="/serialNumQuery/SerialNumQuery.ct" method="post" theme="simple">
	<!-- <input value="<s:property value="code"/>"/>  -->
	
	<table class="tb">
		<tbody>
			<tr class="tb-line">
				<td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
			</tr>
			<tr class="tb-line">
				<td class="tb-td" colspan="4">
					<div class="tb-h3">终端SN号分配</div>
					<input type="hidden" name="code"   value="<s:property value="code"/>"/>
				</td>
			</tr>
			<tr class="tb-line">
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">品牌：</div>
	            </td>
	            <td class="tb-td">
                	<label class="tb-select">
							<s:select cssClass="queryWidth" name="serialNumCondition.posBrand" id="posBrand" onchange="loadBrandCode()"
								list="#request.brandMap" listKey="key" listValue="value"  headerKey="-1" headerValue="不限"/>
					</label>
				</td>
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">机型：</div>
	            </td>
	            <td class="tb-td">
                	<label class="tb-select">
							<s:select cssClass="queryWidth" name="serialNumCondition.posType"
								id="posType"
								list="#request.typeMap" listKey="key" listValue="value"  headerKey="-1" headerValue="不限"/>
					</label>
				</td>
			</tr>
			<tr class="tb-line">
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">型号：</div>
	            </td>
	            <td class="tb-td">
                	<label class="tb-select">
							<s:select cssClass="queryWidth" name="serialNumCondition.posName"
								id="posName"
								list="#request.nameMap" listKey="key" listValue="value"  headerKey="-1" headerValue="不限"/>
								<s:hidden id="selModelCode" name="#request.selModelCode"  />
								<s:hidden id="oldBandCode" name="#request.oldBandCode"  />
					</label>
				</td>
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">pos序列号：</div>
	            </td>
	            <td class="tb-td">
                	<label class="tb-input-normal">
							<s:textfield id="serialNum" name="serialNumCondition.serialNum" cssClass="queryWidth" />
					</label>
				</td>
						
				</tr>
				<tr class="tb-line">
					<td colspan="8" align="center"><div style="color: blue;">
							<s:actionmessage />
						</div>
						<div style="color: red;">
							<s:actionerror />
						</div></td>
				</tr>
				<tr class="tb-line">
		            <td class="tb-td line-submit" align="right" colspan="8">
		                <label class="tb-input-submit">
							<s:submit value="查   询" />
						</label>
		                <label class="tb-input-submit">
							<s:if test="#request.yjPosAgentlist!=null&&#request.yjPosAgentlist.size>0">
								<input type="button" id="fenpei" value="分配" onclick="deal()">
							</s:if>
							<s:else>
								<input type="button" disabled="disabled" id="fenpei" value="分  配" onclick="deal()">
							</s:else>
						</label>
				     </td>
				</tr>
			</table>
				
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<s:if
					test="#request.yjPosAgentlist != null && #request.yjPosAgentlist.size>0">
					<tr class="tb-line">
						<td class="tb-td paging" colspan="4">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/serialNumQuery/SerialNumQuery.ct?code=${code}&currentPage=" />
						</td>
					</tr>
				</s:if>
			</table>
		<div class="big-tb">
		    <table id="tableList" class="tb" style="width: 100%;">
				<thead>
		            <tr class="tb-line">
		                <th class="tb-th" colspan="14">代理商信息变更查询列表</th>
		            </tr>
					<tr class="tb-line bg-gray">
						<th class="tb-th">选择</th>
						<th class="tb-th">终端号</th>
						<th class="tb-th">品牌</th>
						<th class="tb-th">机型</th>
						<th class="tb-th">型号</th>
						<th class="tb-th">是否出库</th>
						<th class="tb-th">入库时间</th>
						<th class="tb-th">出库时间</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.yjPosAgentlist" status="stat" id="oper">
							<tr class="tb-line" >
							
							<td  class="tb-td" align="center">
								<s:checkboxlist name="terList" list="#{#oper.serialNum+'_'+#oper.posBrandCode:''}"  theme="simple" />
					        </td>
							
							<td  class="tb-td" align="center">
							 <s:property value="#oper.serialNum"/>
							</td>
							<td  class="tb-td" align="center">
							 <s:property value="#oper.posBrand"/>
							</td>
							<td  class="tb-td" align="center">
							 <s:property value="#oper.posType"/>
							</td>
							<td  class="tb-td" align="center">
							 <s:property value="#oper.posName"/>
							</td>
							<td  class="tb-td" align="center">
							 <s:property value="#oper.isUsed"/>
							</td>
							<td  class="tb-td" align="center">
							 <s:property value="#oper.dtCreate"/>
							</td>
							<td  class="tb-td" align="center">
							 <s:property value="#oper.dtLastmod"/>
							</td>
						</s:iterator>
				</tbody>
				
			</table>
			</div>
</s:form>
	<s:if test="#request.msg !=null">
		<script language="javascript">
		    alert("${request.msg}");
		</script>
	</s:if>			
</body>
</html>
